package br.inf.solutions.apresentacoes.ssp.view.composer;

import org.springframework.context.annotation.Scope;
import org.zkoss.zk.ui.Component;

import br.com.vexillum.util.ReflectionUtils;
import br.com.vexillum.util.SpringFactory;
import br.inf.solutions.apresentacoes.ssp.control.DispenseFunctionPersonController;
import br.inf.solutions.apresentacoes.ssp.model.Person;
import br.inf.solutions.apresentacoes.ssp.model.bulletin.items.DispenseFunctionPerson;

@SuppressWarnings("serial")
@org.springframework.stereotype.Component
@Scope("prototype")
public class DispenseFunctionPersonComposer extends BulletinItemComposer<DispenseFunctionPerson, DispenseFunctionPersonController> {

	private Person person;
	
	public Person getPerson() {
		return person;
	}

	public void setPerson(Person person) {
		this.person = person;
	}

	@Override
	public void doAfterCompose(Component comp) throws Exception {
		super.doAfterCompose(comp);
		setPerson(getEntity().getPerson());
		loadBinder();
	}
	
	@Override
	protected String getUpdatePage() {
		return null;
	}

	@Override
	protected String getDeactivationMessage() {
		return null;
	}

	@Override
	public DispenseFunctionPersonController getControl() {
		return SpringFactory.getController("dispenseFunctionPersonController", DispenseFunctionPersonController.class, ReflectionUtils.prepareDataForPersistence(this));
	}

	@Override
	public DispenseFunctionPerson getEntityObject() {
		return new DispenseFunctionPerson();
	}

}
